home *** CD-ROM | disk | FTP | other *** search
-
-
-
- FFFFRRRREEEEAAAADDDD((((3333SSSS)))) FFFFRRRREEEEAAAADDDD((((3333SSSS))))
-
-
-
- NNNNAAAAMMMMEEEE
- fread, fwrite - binary input/output
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
-
- ssssiiiizzzzeeee____tttt ffffrrrreeeeaaaadddd ((((vvvvooooiiiidddd ****ppppttttrrrr,,,, ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee,,,, ssssiiiizzzzeeee____tttt nnnniiiitttteeeemmmmssss,,,, FFFFIIIILLLLEEEE ****ssssttttrrrreeeeaaaammmm))));;;;
-
- ssssiiiizzzzeeee____tttt ffffwwwwrrrriiiitttteeee ((((ccccoooonnnnsssstttt vvvvooooiiiidddd ****ppppttttrrrr,,,, ssssiiiizzzzeeee____tttt ssssiiiizzzzeeee,,,, ssssiiiizzzzeeee____tttt nnnniiiitttteeeemmmmssss,,,, FFFFIIIILLLLEEEE
- ****ssssttttrrrreeeeaaaammmm))));;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _f_r_e_a_d copies, into an array pointed to by _p_t_r, up to _n_i_t_e_m_s items of data
- from the named input _s_t_r_e_a_m, where an item of data is a sequence of bytes
- (not necessarily terminated by a null byte) of length _s_i_z_e. _f_r_e_a_d stops
- reading bytes if an end-of-file or error condition is encountered while
- reading _s_t_r_e_a_m, or if _n_i_t_e_m_s items have been read. The file pointer
- associated with _s_t_r_e_a_m is positioned following the last byte read, which
- may be at end-of-file. _f_r_e_a_d does not change the contents of _s_t_r_e_a_m.
- _f_r_e_a_d returns the number of items read.
-
- _f_w_r_i_t_e appends at most _n_i_t_e_m_s items of data from the array pointed to by
- _p_t_r to the named output _s_t_r_e_a_m. _f_w_r_i_t_e stops appending when it has
- appended _n_i_t_e_m_s items of data or if an error condition is encountered on
- _s_t_r_e_a_m. _f_w_r_i_t_e does not change the contents of the array pointed to by
- _p_t_r. _f_w_r_i_t_e increments the data-printer in the stream by the number of
- bytes written. If an error occurs, the resulting value of the file-
- position indicator for the stream is indeterminate. _f_w_r_i_t_e returns the
- number of items written.
-
- _f_e_r_r_o_r(_3_S) may be used to determine if an error occurred in an _f_r_e_a_d or
- _f_w_r_i_t_e call. The _f_e_r_r_o_r(_3_S) or _f_e_o_f(_3_S) routines should be used to
- distinguish between an error condition and end-of-file condition.
-
- The argument _s_i_z_e is typically _s_i_z_e_o_f(*_p_t_r) where the C operator _s_i_z_e_o_f
- is used to determine the length of an item pointed to by _p_t_r.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- exit(2), fcntl(2), lseek(2), read(2), write(2), abort(3C), fclose(3S),
- fopen(3S), ferror(3S), getc(3S), gets(3S), printf(3S), putc(3S),
- puts(3S), scanf(3S), stdio(3S).
-
- NNNNOOOOTTTTEEEE
- To use these functions with direct I/O (see _f_c_n_t_l(2)), it is necessary to
- arrange that the buffers be correctly aligned before any I/O is done.
- One way to do this is:
-
- char *caBuffer11;
- caBuffer11 = memalign(dioinfo.d_mem, 8+100 * dioinfo.d_miniosz);
- setbuffer(fpOutFile,caBuffer11,8+100 * dioinfo.d_miniosz);
-
- where the _d_i_o_i_n_f_o structure has been filled in by the FFFF____DDDDIIIIOOOOIIIINNNNFFFFOOOO _f_c_n_t_l
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- FFFFRRRREEEEAAAADDDD((((3333SSSS)))) FFFFRRRREEEEAAAADDDD((((3333SSSS))))
-
-
-
- request.
-
- DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
- Both _f_r_e_a_d and _f_w_r_i_t_e always return a nonnegative integer indicating the
- number of items read or written. This will be equal to _n_i_t_e_m_s unless an
- error occurred, the value of _s_i_z_e is zero, or _f_r_e_a_d or _f_w_r_i_t_e detect that
- a request has been made to read (or write) more data than is addressable.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-